package com.apes.scm.masterdata.party.repository;

import com.apes.framework.jpa.repository.CustomRepository;
import com.apes.scm.masterdata.party.model.CustomerBusiness;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.Date;
import java.util.List;

/**
 *
 *@description: 客户业务关系数据层
 *@author: wsj
 *@time: 2020/7/9 17:14
 * 
 */
public interface CustomerBusinessRepository extends CustomRepository<CustomerBusiness,String > {
    @Query("select a  from CustomerBusiness a where a.lastUpdatedStamp > :times " +
            "   or (a.id > :id and a.lastUpdatedStamp = :times) and a.valid =true " +
            " order by a.lastUpdatedStamp, a.id asc ")
    List<CustomerBusiness> queryCustomerBusiness(@Param("times") Date times, @Param("id") String id, Pageable pageable);
}
